package com.example.core

import android.app.Application
import android.content.Context

class BaseApplication: Application() {
//    companion object{
//        private lateinit var currentApplication:Context;
//        public fun   currentApplication():Context {
//            return currentApplication;
//        }
//    }
    //优化以上外部可访问的静态对象
    companion object{
//          lateinit var currentApplication:Context//java中访问还是要借助Companion
          @JvmStatic
          @get:JvmName("currentApplication")//但这里在java中访问时还是不能象kotlin中一样直接访问属性名，加这句
          lateinit var currentApplication:Context//java中访问还是要借助Companion
          private set//表示私有set外部不能修改，而默认的get可以外部访问
    }
    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        currentApplication = this;
    }
}